package com.xindz.cn.mvptest.components.product.persenter;

import com.avos.avoscloud.AVException;
import com.avos.avoscloud.SaveCallback;
import com.xindz.cn.mvptest.base.BasePresenter;
import com.xindz.cn.mvptest.components.product.data.AttachProductBean;
import com.xindz.cn.mvptest.components.product.model.ProductModel;
import com.xindz.cn.mvptest.components.product.view.ProductAddView;

/**
 * @name MvpTest
 * @class name：com.xindz.cn.mvptest.components.product.persenter
 * @describe describe
 * @anthor XINDZ
 * @time 2017/10/30 18:49
 * @change
 * @chang time
 * @class describe
 */
public class ProductAddPersenter extends BasePresenter<ProductAddView> {
    private ProductModel productModel;

    public ProductAddPersenter() {
        this.productModel = new ProductModel();
    }

    public void addProduct(AttachProductBean attachProductBean , String title, String des, String imagename, String xindz, int price) {
        productModel.saveInBackground(attachProductBean,title, des, imagename, xindz, price, new SaveCallback() {
            @Override
            public void done(AVException e) {
                getView().add(e);
            }
        });
    }

}
